<?php
/**
 * Created by JetBrains PhpStorm.
 * User: shaoshuai
 * Date: 11-10-2
 * Time: PM9:08
 * To change this template use File | Settings | File Templates.
 */

include_once '../common.func.php';
$vid = trim($_GET['vid']);
if (!$vid) {
    exit('comment not found');
}

$verify = getVerify();
$key = '';
foreach ($verify as $i => $c) {
    if ($c['vid'] == $vid) {
        if ($_GET['delete'] == '1') {
            unset($verify[$i]);
            break;
        }
        $post = getPostById($c['id']);
        if ($post) {
            $key = $c['id'];
            unset($c['verify_url']);
            unset($c['verify_delete']);
            unset($c['vid']);
            array_push($post['comments'], $c);
            updatePostById($key, $post);
            compilePostById($key, $post);
        }
        break;
    }
}
//header('Location: ' . SITE_URL . '/post/' . $key . '.html?status=verify');
exit('comment verified');
